package com.woniuxy.project.campus.account.controller;


import com.woniuxy.project.campus.account.model.RoleAccount;
import com.woniuxy.project.campus.account.service.RoleAccountService;
import com.woniuxy.project.campus.util.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 吴彦祖
 * @since 2025年02月17日
 */
@RestController
@RequestMapping("/roleAccount")
public class RoleAccountController {

    @Resource
    private RoleAccountService roleAccountService;


    //传入用户id，获取用户角色id
@ApiOperation(value = "获取用户角色信息")
    @GetMapping("/getRoleId")
    public Result getRoleId(@RequestParam("id") Integer id) throws Exception{
        RoleAccount roleAccount =roleAccountService.getRoleId(id);
        return Result.success(roleAccount);
    }

    //传入用户id， 修改角色id
    @ApiOperation(value = "修改用户角色")
    @GetMapping("/updateRoleId")
    public Result updateRoleId(@RequestParam("id") Integer id) throws Exception{
         roleAccountService.updateRoleId(id);
        return Result.success(null);
    }
}

